package mvp.com.bbc.rcjavaretrofitdaggermvp.mvp.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import mvp.com.bbc.rcjavaretrofitdaggermvp.R;
import mvp.com.bbc.rcjavaretrofitdaggermvp.baseAF.BaseFragment;
import mvp.com.bbc.rcjavaretrofitdaggermvp.mvp.adapter.BaseFrgamenAdapter;

/**
 * Created by ${cbf} on 2017/12/2.
 */

public class ArticeFragment extends BaseFragment {
    @BindView(R.id.tablayout)
    TabLayout tablayout;
    @BindView(R.id.viewPager)
    ViewPager viewPager;

    @Override
    protected int setContentLayout() {
        return R.layout.fragment_artice_list;
    }

    @Override
    protected void findViews() {

    }

    @Override
    protected void init() {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(ArticeListFragment.newInstance("1"));
        fragments.add(ArticeListFragment.newInstance("2"));
        String[] title = new String[]{"最新", "热门"};
        BaseFrgamenAdapter adapter = new BaseFrgamenAdapter(getChildFragmentManager(), fragments, title);
        viewPager.setAdapter(adapter);
        tablayout.setupWithViewPager(viewPager);
    }

    @Override
    protected void setListeners() {

    }

    @Override
    public void onClick(View view) {

    }

    public static Fragment Instance(Context context, String mallInfo) {
        ArticeFragment fragment = new ArticeFragment();
        Bundle bundle = new Bundle();
        bundle.putString("name", mallInfo);
        fragment.setArguments(bundle);
        return fragment;
    }

}
